/**
 * @file eth task.h
 **/

#ifndef _NET_TASK_DEF_H
#define _NET_TASK_DEF_H

#include "stdint.h"
#include "core/net.h"
#include "dhcp/dhcp_client.h"
#include "ipv6/slaac.h"
#include "core/bsd_socket.h"

//C++ guard
#ifdef __cplusplus
extern "C" {
#endif

	

#define IsValidFD( X )              ( ( X ) >= 0 )

typedef struct _socket_port_t 
{
    int                     fd;  
    uint32_t                localPort;
    uint32_t                remotePort;
    char                    remoteServerDomain[64];
} socket_port_t;

#define TRACE_LEVEL TRACE_LEVEL_DEBUG

//Application configuration
#define APP_MAC_ADDR "00-AB-CD-EF-04-29"
#define APP_USE_DHCP ENABLED
#define APP_IPV4_HOST_ADDR "192.168.1.125"
#define APP_IPV4_SUBNET_MASK "255.255.255.0"
#define APP_IPV4_DEFAULT_GATEWAY "192.168.1.1"
#define APP_IPV4_PRIMARY_DNS "8.8.8.8"
#define APP_IPV4_SECONDARY_DNS "8.8.4.4"

#define APP_USE_SLAAC ENABLED
#define APP_IPV6_LINK_LOCAL_ADDR "fe80::429"
#define APP_IPV6_PREFIX "2001:db8::"
#define APP_IPV6_PREFIX_LENGTH 64
#define APP_IPV6_GLOBAL_ADDR "2001:db8::429"
#define APP_IPV6_ROUTER "fe80::1"
#define APP_IPV6_PRIMARY_DNS "2001:4860:4860::8888"
#define APP_IPV6_SECONDARY_DNS "2001:4860:4860::8844"

#define APP_SERVER_NAME "192.168.1.122"
#define APP_SERVER_PORT 5000

// Global var
extern DhcpClientSettings dhcpClientSettings;
extern DhcpClientContext dhcpClientContext;
extern SlaacSettings slaacSettings;
extern SlaacContext slaacContext;

// Application
	void emb_server_init(void);
	void emb_server_deinit(void);
	
	void eth_app_server_init(void);
	void eth_app_server_deinit(void);
	
	void etcp_server_init(void);
	void etcp_server_deinit(void);
	
	void etcp_client_init(void);
	void etcp_client_deinit(void);
	
	void mb_client_init(void);
	void mb_client_deinit(void);
	
// C++ guard
#ifdef __cplusplus
}
#endif

#endif
